package cn.classTest.mall.domain;

import com.alibaba.fastjson.JSON;
import lombok.Data;

import javax.management.relation.Role;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Data
public class Employee {
    private Long id;
    private String name;
    private String password;
    private String email;
    private Integer age;
    private boolean admin = false;
    private Department dept;
    private List<Role> roles;

    private String json;

    public String getJson() {
        Map<String, Object> map = new HashMap<>();
        map.put("id",id);
        map.put("name",name);
        map.put("password",password);
        map.put("email",email);
        map.put("age",age);
        map.put("admin",admin);
        map.put("dept",dept);
        map.put("roles",roles);
        return JSON.toJSONString(map);
    }

}
